<template>
  <view class="noticeLayout">
    <view class="title">
      <view class="tag" v-if="detailList?.select">
        <uni-tag inverted text="置顶" type="error" />
      </view>
      <view class="font">{{ detailList?.title }}</view>
    </view>

    <view class="info">
      <view class="item">{{ detailList?.author }}</view>
      <view class="item">
        <uni-dateformat
          :date="detailList?.publish_date"
          format="yyyy-MM-dd hh:mm:ss"
        ></uni-dateformat>
      </view>
    </view>

    <view class="content">
      <!-- <mp-html :content="detailList?.content" /> -->
      <mpHtml :content="detailList?.content"></mpHtml>
      <!-- <rich-text :nodes="detailList.content"></rich-text> -->
    </view>

    <view class="count"> 阅读 {{ detailList?.view_count }} </view>
  </view>
</template>

<script setup>
import { onLoad } from "@dcloudio/uni-app";
import { getNewDeatilAPI } from "@/apis/apis.js";
import { ref } from "vue";

// 引入我们uniapp中的插件市场上的插件
import mpHtml from "mp-html/dist/uni-app/components/mp-html/mp-html";

const detailList = ref({});
let noticeId;
onLoad((e) => {
  noticeId = e.id;
  getNoticedetailList();
});

const getNoticedetailList = async () => {
  const res = await getNewDeatilAPI({ id: noticeId });
  // console.log(res, "我获取到了详情");
  detailList.value = res.data;
};
</script>

<style lang="scss" scoped>
.noticeLayout {
  padding: 30rpx;
  .title {
    font-size: 40rpx;
    color: #111;
    line-height: 1.6em;
    padding-bottom: 30rpx;
    display: flex;
    .tag {
      transform: scale(0.8);
      transform-origin: left center;
      flex-shrink: 0;
    }
    .font {
      padding-left: 6rpx;
    }
  }
  .info {
    display: flex;
    align-items: center;
    color: #999;
    font-size: 28rpx;
    .item {
      padding-right: 20rpx;
    }
  }
  .content {
    padding: 50rpx 0;
  }
  .count {
    color: #999;
    font-size: 28rpx;
  }
}
</style>
